// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import VueResource from 'vue-resource'
import router from './router'
import {lib, isIPhone} from './assets/js/util'
import * as filters from './assets/js/filters'
Vue.config.productionTip = false

Object.keys(filters).forEach(key => Vue.filter(key, filters[key]))

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>',
  created () {
    (function (doc, win) {
      var docEl = doc.documentElement
      var resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'
      var recalc = function () {
        var clientWidth = docEl.clientWidth
        if (!clientWidth) {
          return
        }
        if (clientWidth > 540) {
  //        docEl.style.fontSize = '72px'
          docEl.style.cssText += 'font-size: 72px !important;'
        } else {
  //        docEl.style.fontSize = 100 * (clientWidth / 750) + 'px'
          docEl.style.cssText += 'font-size: ' + (100 * (clientWidth / 750)) + 'px !important;'
        }
      }
      if (!doc.addEventListener) {
        return
      }
      win.addEventListener(resizeEvt, recalc, false)
      doc.addEventListener('DOMContentLoaded', recalc, false)
    })(document, window)
    // lib.responsive()
  },
})
